import { createApp } from 'vue'

import App from './App.vue'
import router from './router'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

import './assets/main.css'

import ECharts from 'vue-echarts' // 引入 ECharts
// 1. 导入 ECharts 核心模块
import { use } from 'echarts/core'
import { CanvasRenderer } from 'echarts/renderers'  // 渲染器
// 2. 导入所有图表类型（按需添加）
import {
  LineChart,        // 折线图
  BarChart,         // 柱状图
  PieChart,         // 饼图
} from 'echarts/charts'

// 3. 导入所有组件（按需添加）
import {
  GridComponent,          // 网格
  TooltipComponent,       // 提示框
  LegendComponent // 图例
  // 添加更多组件...
} from 'echarts/components'


const app = createApp(App)

app.use(router)
app.use(ElementPlus, {locale: zhCn})
use([
  CanvasRenderer,
  // 注册图表
  LineChart,
  BarChart,
  PieChart,
  // 注册组件
  GridComponent,
  TooltipComponent,
  LegendComponent
])
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}
app.component('v-chart', ECharts) // 全局注册 ECharts 组件
app.mount('#app')


